gdkwindow: Don't create a subsurface if we don't need to
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 21 Jun 2014 00:46:49 +0000 (20:46 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 21 Jun 2014 00:46:49 +0000 (20:46 -0400)
In the case we have a native window, we don't need to crop it to a
non-native subrectangle, as abs_x / abs_y / width / height are all 0.

gdk/gdkwindow.c

index 2853a30f75a715912625524c73047a3981978262..7638a33655b84a7fa11302bbd6091ed837d86298 100644 (file)
@@ -3004,11 +3004,18 @@ _gdk_window_ref_cairo_surface (GdkWindow *window)
 
   surface = get_window_surface (window);
 
-  return cairo_surface_create_for_rectangle (surface,
-                                             window->abs_x,
-                                             window->abs_y,
-                                             window->width,
-                                             window->height);
+  if (gdk_window_has_impl (window))
+    {
+      return surface;
+    }
+  else
+    {
+      return cairo_surface_create_for_rectangle (surface,
+                                                 window->abs_x,
+                                                 window->abs_y,
+                                                 window->width,
+                                                 window->height);
+    }
 }
 
 /**